import { defineConfig } from '@vben/vite-config';

export default defineConfig(async () => {
  return {
    application: {},
    vite: {
      server: {
        proxy: {
          '/api': {
            changeOrigin: true,
            rewrite: (path: string) => path.replace(/^\/api/, ''),
            // 实际后端服务地址
            target: 'http://localhost:8080',
            ws: true,
          },
          // 认证服务代理
          '/auth-api': {
            changeOrigin: true,
            rewrite: (path: string) => path.replace(/^\/auth-api/, ''),
            // 认证服务地址（目前与主服务相同）
            target: 'http://localhost:8080',
            ws: true,
          },
          // 示例应用服务代理
          '/example-app-api': {
            changeOrigin: true,
            rewrite: (path: string) => path.replace(/^\/example-app-api/, ''),
            // 示例应用服务地址（目前与主服务相同）
            target: 'http://localhost:8080',
            ws: true,
          },
        },
      },
    },
  };
});
